@layout("/common/_curd/_container.html"){

<script type="text/javascript">
	var ctx = "${basePath}";
	var grid_selector = "#grid-table";
	var pager_selector = "#grid-pager";

	$(function(){
		initGrid();
		initMenuBtn("btns", "${code}");
	});

	function initGrid(){
		var grid_url = ctx + "/${code}/beihuolist";
		var _colnames = ["主键",
						"学校",
//						"检验图片",
						"提交时间",
//						"审核状态",
						"详情"];
		var _colmodel = [{name:"id", index:"id", hidden:true,width:100},
						{name:"schoolname", index:"schoolname", width:100},
//						{name:"pic", index:"pic", width:100,formatter:function (value, row, index) {
//							var src = "nopic.jpg";
//							if(value!=null){
//								src = value;
//								src = src.split(",");
//								src = src[1]
//							}
//
//							console.log("src = /upload/"+src)
//
//							return  '<image height="75px" width="100px" src="/upload/'+src+'"></image>';
//						}},
						{name:"date", index:"date", width:100},
//						{name:"status", index:"status", width:100,formatter:function (value, row, index) {
//							if(value === 1){
//								return "已提交";
//							}else if(value ===2){
//								return "审核已通过";
//							}else if(value ===3){
//								return "审核未通过";
//							}
//						}},
						{name:"deptid", index:"deptid", width:100,formatter:function (value, row, index) {
							return  '<a href="#" class="btn btn-btn btn-white btn-xs"  onclick="details('+"'"+index.id+"','"+value+"'"+')">'+"查看详情"+'</a>' ;
						}}];

		jQuery(grid_selector).jqGrid({
			url : grid_url,
		    shrinkToFit : true,
			colNames : _colnames,
			colModel : _colmodel,
			jsonReader : {id :"id"},
			pager : pager_selector,
			postData : {sort : "id",
//				where:"{uid:"+${uid!}+"}",
				order : "desc"}
		});
	}

	details = function (id,dept) {
		layer.open({
			type: 2,
			title: '备货详情',
			shadeClose: true,
			area: ['90%', '90%'],
			content: '/buynum/beihuodetail?id='+id+'&&did=' + dept//iframe的url
			,end:function () {
				$('#quantity').focus()
			}
		})
	}
</script>


	<!-- 配置 grid -->
	<div class="row">
		<div class="col-xs-12 tb-grid">
			<!-- 配置 查询 -->
			<!-- 按钮 -->
			<!--<div class="welljq well-sm" id="btns"></div>-->
			<!-- grid -->
			<table id="grid-table"></table>
			<!-- 分页-->
			<div id="grid-pager"></div>
		</div>
	</div>

	<!-- 引入所需的js -->
	@include("/common/_listscript.html"){}

@}